if not CLIENT then return false end -- Clientside only :)

--[[
made by:
 ____ _______                    _
|  __|__   __|_  _ __   ____  __| |
 \ \    | |/ _ \| '_ \ / __ )/ _` |
 _\ \   | | (_) | | | | (___| (_| |
|____|  |_|\___/|_| |_|\__,_)\__,_|

]]

Say = {}
Say.Players = {}
Say.Version = 1.1

local enabled = CreateClientConVar("say_enabled",1,true,false)
local text = CreateClientConVar("say_text","This is a sample text",true,false)

function Say.Trace()
	local trace = LocalPlayer():GetEyeTraceNoCursor()
	local ent = trace.Entity
	if ent:IsValid() and ent:IsPlayer() then
		return true, ent
	else
		return false
	end
end

function Say.Think()
	local bool, ent = Say.Trace()
	if bool and ent and enabled:GetBool() and !table.HasValue(Say.Players,ent)then
		Say.Players[#Say.Players + 1] = ent
		RunConsoleCommand("say",text:GetString().." "..ent:Name())
	end
end
hook.Add("Think","Say Hook",Say.Think)